<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>权限列表</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../static/css/font.css">
		<link rel="stylesheet" href="../../../static/css/weadmin.css">
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">用户管理</a>
        <a>
          <cite>权限列表</cite></a>
      </span>
			<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<div class="weadmin-body">
			<div class="weadmin-block">
				<!-- <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button> -->
				<button class="layui-btn" onclick="WeAdminShow('添加权限','/admin/user/authlist/addauth',800,300)"><i class="layui-icon"></i>添加权限</button>
				<span class="layui-laypage-count" style="line-height:40px"></span>
			</div>
			<table id="demo" lay-filter="test" class="layui-hide"></table>

<script src="../../../lib/layui/layui.js"></script>
		</div>
		<script src="../../../lib/layui/layui.js" charset="utf-8"></script>
		<script src="../../../static/js/eleDel.js" type="text/javascript" charset="utf-8"></script>
		<script>
			layui.use('table', function(){
			  var table = layui.table;
			  //第一个实例
			  table.render({
				elem: '#demo'
				,height: 315
				,url: '/admin/user/authlist/api/authlist' //数据接口
				,page: true //开启分页
				// ,toolbar: '#toolbarDemo'
				,limit:5
				,cols: [[ //表头
				  {type: 'checkbox', fixed: 'left'}
				  ,{field: 'id', title: 'ID',fixed: 'left', width:60}
				  ,{field: 'authname', title: '权限名称', width:150}
				  ,{field: 'authurl', title: '权限路径'}
				  ,{field: 'brief', title: '权限说明', width:370}
				  ,{field: 'wealth', title: '操作',toolbar: '#caozuo'}
				]]
			  });
			});
			</script>
			<script type="text/html" id="caozuo">
				<a class="layui-btn layui-btn-xs" lay-event="edit" onclick="WeAdminShow('编辑','/admin/user/authlist/editauth?id={{d.id}}',800,450)">编辑</a>
				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" onclick="auth_del(this,'{{d.id}}')">删除</a>
			</script>
			  <script>
				  layui.use(['table','jquery','layer'], function(){
					  var table = layui.table;
					  var layer = layui.layer
					  var $ = layui.jquery
					  window.auth_del = function (obj,id) {
					  layer.confirm("确认删除吗？",function(index){
						  //发一部数据
						  $.get('/admin/user/authlist/delauth?userid=' + id).then((res)=>{
							layer.msg("已删除！",{
							  icon:1,
							  time:2000
							})
							setTimeout(()=>{
								location.reload()
							})
						  })
					  });
				  }
				  })
			  </script>
	</body>

</html>